/*
var shopPoint = [];
//将数据显示在百度地图上
var ShowMap = function(Item) {
	var opts = {
		width: 0, // 信息窗口宽度,0为自动适配
		height: 0, // 信息窗口高度，0为自动适配
		title: "餐厅信息", // 信息窗口标题
		enableMessage: true //设置允许信息窗发送短息
	};
	var myGeo = new BMap.Geocoder();
	myGEO();

	function myGEO() {
		for(var i = 0; i < Item.length; i++) {
			var add = Item[i].site;
			SetPoint(add,i);
		}
	}

	function SetPoint(add,index) {
		myGeo.getPoint(add, function(point) {
			if(point) {
				shopPoint.push({
					index : index,
					lng: point.lng,
					lat: point.lat
				});
				var address = new BMap.Point(point.lng, point.lat);
				addMarker(address, index);
				//console.log(index);
			}
		}, "绵阳市");
	}

	function addMarker(point, i) {
		var R = Item[i].color.R;
		var G = Item[i].color.G;
		var B = Item[i].color.B;
		var marker = new BMap.Circle(point, 30, {
			strokeColor: "rgb(" + R + "," + G + "," + B + ")",
			strokeWeight: 1,
			strokeOpacity: 1,
			fillOpacity: 1,
			fillColor: "rgb(" + R + "," + G + "," + B + ")"
		});
		map.addOverlay(marker);
		addMouseOverHadler(marker, i);
		addClickHadler(marker, i);
	}

	function addMouseOverHadler(m, i) {
		m.addEventListener("onmouseover", function(e) {
			//				console.log(e);
			if(map.getZoom() >= 16) {
				var content = "名称：" + Item[i].name + " 地址：" + Item[i].site + " 评分：" + Item[i].star;
				var point = new BMap.Point(e.point.lng, e.point.lat);
				var infoWindow = new BMap.InfoWindow(content, opts); // 创建信息窗口对象 
				map.openInfoWindow(infoWindow, point); //开启信息窗口
			}
		});
	}
	
	function addClickHadler(m,i) {
		m.addEventListener("click",function(e){
			if(map.getZoom() >= 16){
				radarMap("#radarMap",Item[i],i);
			}
		});
	}
}
*/

var shopPoint = [];
//将数据显示在百度地图上
var ShowMap = function(Item) {
	var opts = {
		width: 0, // 信息窗口宽度,0为自动适配
		height: 0, // 信息窗口高度，0为自动适配
		title: "餐厅信息", // 信息窗口标题
		enableMessage: true //设置允许信息窗发送短息
	};
	var myGeo = new BMap.Geocoder();
	myGEO();

	function myGEO() {
		for(var i = 0; i < Item.length; i++) {
			var add = Item[i].site;
			SetPoint(add,i);
		}
	}

	function SetPoint(add,index) {
		myGeo.getPoint(add, function(point) {
			if(point) {
				shopPoint.push({
					index : index,
					lng: point.lng,
					lat: point.lat
				});
				var address = new BMap.Point(point.lng, point.lat);
				addMarker(address, index);
				//console.log(index);
			}
		}, "绵阳市");
	}

	function addMarker(point, i) {
		var R = Item[i].color.R;
		var G = Item[i].color.G;
		var B = Item[i].color.B;
		var marker = new BMap.Circle(point, 30, {
			strokeColor: "rgb(" + R + "," + G + "," + B + ")",
			strokeWeight: 1,
			strokeOpacity: 1,
			fillOpacity: 1,
			fillColor: "rgb(" + R + "," + G + "," + B + ")"
		});
		map.addOverlay(marker);
		addMouseOverHadler(marker, i);
		addClickHadler(marker, i);
	}

	function addMouseOverHadler(m, i) {
		m.addEventListener("onmouseover", function(e) {
			//				console.log(e);
			if(map.getZoom() >= 16) {
				var star = "";
				for(var j = 0;j<Item[i].star;j++){
					star += "★";
				}
				var content = "名称：" + Item[i].name + " 评分：" + star + " 地址：" + Item[i].site;
				var point = new BMap.Point(e.point.lng-0.000005, e.point.lat-0.000005);
				var infoWindow = new BMap.InfoWindow(content, opts); // 创建信息窗口对象 
				map.openInfoWindow(infoWindow, point); //开启信息窗口
			}
		});
	}
	
	function addClickHadler(m,i) {
		m.addEventListener("click",function(e){
			if(map.getZoom() >= 16){
				radarMap("#radarMap",Item[i],i);
			}
		});
	}
}
